package com.zzj.controller;

import com.zzj.bean.DeptBean;
import com.zzj.service.DeptService;
import com.zzj.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("Dept")
public class DeptController {
    @Autowired
    private DeptService deptService;
    @PostMapping("addDept")
    public Result addDept(@RequestBody DeptBean deptBean){
        return deptService.addDept(deptBean);
    }
    @PostMapping("updateDept")
    public Result updateDept(@RequestBody DeptBean deptBean){
        System.out.println("deptBean = " + deptBean);
        return deptService.updateDept(deptBean);
    }

    @GetMapping("findAllDept")
    public Result<List<DeptBean>> findAllDept(){
        return deptService.findAllDept();
    }
    @GetMapping("findByDid")
    public Result<DeptBean> findDeptByDid(Integer did){
        return deptService.findDeptByDid(did);
    }
}
